<template>
  <div>
    <h2>我是Home的内容</h2>
    <div>
      <ul class="nav nav-tabs">
        <li>
          <router-link class="list-group-item" active-class="active" to="/home/news">News</router-link>
        </li>
        <li>
          <router-link class="list-group-item" active-class="active" to="/home/message">Message</router-link>
        </li>
      </ul>

      <!-- 
        缓存视图
        include属性配置项是组件名 组件名 组件名
        多个缓存组件 用动态绑定数组形式
        不配置include  表示缓存所有
      -->
      <!-- <keep-alive>
        <router-view></router-view>
      </keep-alive> -->

      <!-- <keep-alive include="News">
        <router-view></router-view>
      </keep-alive> -->

      <keep-alive :include="['News', 'Message']">
        <router-view></router-view>
      </keep-alive>
      
    </div>
  </div>
</template>

<script>
  export default {
    name: "Home",
    /* beforeDestroy() {
      console.log('Home组件即将被销毁了')
    }, */
    mounted() {
      // console.log('Home组件挂载完毕了', this)
      window.homeRoute = this.$route;
      window.homeRouter = this.$router;
    }
  }
</script>